package com.odin.core.service;

import com.odin.core.dao.ResourceMapper;
import com.odin.core.dao.RoleMapper;
import com.odin.core.dao.RoleResourceMapper;
import com.odin.core.entity.Resource;
import com.odin.core.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService {

    @Autowired
    RoleMapper roleMapper;

    @Autowired
    RoleResourceMapper roleResourceMapper;

    @Autowired
    ResourceMapper resourceMapper;

    public List<Resource> findResourceByRole(String roleId){
        Role role = roleMapper.selectByPrimaryKey(roleId);
        return resourceMapper.findByRoleId(roleId);
    }

}
